package com.authine.cloudpivot.ext.service;

import com.alibaba.cola.dto.SingleResponse;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeCancelPayment;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeePlatFormPayment;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeePlatformCollection;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeePlatformWriteOff;
import com.authine.cloudpivot.ext.kingdee.work.MoneyWork;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import java.util.List;

import static com.authine.hermes.app.launcher.service.ApplicationServiceFoundation.CUSTOM_SERVICE;

/**
 * @Author: liwei
 * @DateTime: 2021/7/6
 * @Description: TODO 款项生成凭证服务
 */
@Slf4j
public class MoneyVoucherService {

    private MoneyWork moneyService = new MoneyWork();

    //    平台付款：/create/payment
    public SingleResponse platformPayment( KingDeePlatFormPayment kingDeePlatFormPayment) {
        Assert.notNull(kingDeePlatFormPayment, "平台付款 入参数据为空");

        return moneyService.platformPayment(kingDeePlatFormPayment);
    }

    //    平台取消付款：/cancel/payment
    public SingleResponse platformCancelPayment( List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "平台取消付款 入参数据为空");

        return moneyService.platformCancelPayment(kingDeeCancelPayments);
    }

    //    平台收款：/create/collection
    public SingleResponse platformCollection( KingDeePlatformCollection collection) {
        Assert.notNull(collection, "平台收款 入参数据为空");

        return moneyService.platformCollection(collection);
    }

    //    取消收款：/cancel/collection
    public SingleResponse platformCancelCollection( List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "取消收款 入参数据为空");

        return moneyService.platformCancelCollection(kingDeeCancelPayments);
    }

    /*    平台退款：/return/collection */
    public SingleResponse platformReturnCancelPayment( KingDeePlatformCollection collection) {
        Assert.notNull(collection, "平台退款 入参数据为空");

        return moneyService.platformReturnCancelPayment(collection);
    }

    /*  平台取消退款：/cancel/return/collection */
    public SingleResponse platformCancelReturnCancelPayment( List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "平台取消退款 入参数据为空");

        return moneyService.platformCancelReturnCancelPayment(kingDeeCancelPayments);
    }

    /* 平台核销：/write/off */
    public SingleResponse platformWriteOff( KingDeePlatformWriteOff kingDeePlatformWriteOff) {
        Assert.notNull(kingDeePlatformWriteOff, "平台核销 入参数据为空");

        return moneyService.platformWriteOff(kingDeePlatformWriteOff);
    }

    /* 平台取消核销：/cancel/write/off */
    public SingleResponse platformCancelWriteOff( List<KingDeeCancelPayment> kingDeeCancelPayments) {
        Assert.isTrue(!CollectionUtils.isEmpty(kingDeeCancelPayments), "平台取消核销 入参数据为空");

        return moneyService.platformCancelWriteOff(kingDeeCancelPayments);
    }

}
